﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using ScrumFactory.Composition;
using ScrumFactory.ProjectTeam.ViewModel;
using ScrumFactory.Services;
using ScrumFactory;

namespace ScumFactory.ProjectTeam.Tests {

    /// <summary>
    /// Test the Project Team View Model.
    /// </summary>
    [TestClass()]
    public class ProjectTeamViewModelTest {
        
        [TestMethod()]
        public void ShowRolesListCommand_ShouldShowRolesListView() {

            // (1) SETUP MOCKS
            var aggregator = SetupAggregator();

            // (2) CREATE TARGET
            var target = new ProjectTeamViewModel();
            target.ShowRolesListCommand.Execute(null);            

            // (3) ASSERT TESTS
            aggregator.Verify(a => a.Publish<IPanelViewModel>(ScrumFactoryEvent.OpenNewWindow, (IPanelViewModel) target.RolesListViewModel), "Open New Window was not published for Roles List");

            

        }


        #region Setup Mocks

        Mock<IEventAggregator> SetupAggregator() {
            var aggregator = new Mock<IEventAggregator>();
            return aggregator;
        }

        #endregion
    }
}
